package br.com.jpoker.common.ui.components;

import java.awt.Color;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JPanel;

@SuppressWarnings("serial")
public class JGradientPanel extends JPanel {

	private int profundidade = 300;
	private Color background;
	private Color gradient;
	
	public JGradientPanel(Color background, Color gradient, int profundidade) {
		this.background = background;
		this.gradient = gradient;
		this.profundidade = profundidade;
		super.setBackground(gradient);
	}

	@Override
	public boolean isOpaque() {
		return false;
	}

	@Override
	protected void paintComponent(Graphics g) {
		((Graphics2D)g).setPaint(new GradientPaint(getWidth()/2,profundidade,background,getWidth()/2,0,gradient, false));
		g.setClip(null);
		((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		g.fillRoundRect(0,0,getWidth(),getHeight(),0 ,0);
		g.setFont(Font.decode("arial 40"));
		g.drawString("Teste", getWidth()-300, getHeight()-100);
		super.paintComponent(g);
	}

	public int getProfundidade() {
		return profundidade;
	}

	public void setProfundidade(int profundidade) {
		this.profundidade = profundidade;
	}

}